function varitest(time,y,a,m,b,yic,Y,casenum)

load('orthbase');

switch casenum
    case 1
        load('case1');
        exactvar=mcpart;
        %exactvar=time.^2;
    case 2
        load('case2');
        exactvar=mcpart;
    case 3
        load('case3');
        %the exact variance is exactvar=3/2*time+1/4*exp(-2*time)-1/4;
        exactvar=mcpart;
    case 4
        %load('case2');
        load('case4_2')
        %exactvar=1/4*mcpart+3/2*time'+1/4*exp(-2*time)'-1/4;
        exactvar=1/4*mcpart+1/2*time.^2';
    case 5
        exactvar=3/2*time'+1/4*exp(-2*time)'-1/4;
        %exactvar=1/2*time.^2;
        exactvar=time;
end

hold on
plot(time,exactvar);
tmp=zeros(size(y(:,1)));
for ii=1:size(Y,2)
    %tmp=tmp+Y(:,ii).*Y(:,ii);
    tmp=tmp+Y(:,ii);
end
plot(time,tmp,'r-');
title('Variance')
legend('exact var','wce var');